﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;

namespace XiaoYuStock.WebApp.Helpers
{
    public class LoginUser
    {
        /// <summary>
        /// 登录帐号
        /// </summary>
        public string UserName { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string Password { get; set; }

    }

        /// <summary>
        /// 作者：Vincen
        /// 时间：2013.10.15
        /// 描述：登录用户的管理
        /// </summary>
        public class LoginUserManager
        {

            private static string LoginUserKey = "@####Login_SFF";
            /// <summary>
            /// 作者：Vincen
            /// 时间：2014.04.25
            /// 描述：当前登录用户
            /// </summary>
            public static LoginUser CurrLoginUser
            {
                get
                {
                    return HttpContext.Current.Session[LoginUserKey] as LoginUser;
                }
            }

            /// <summary>l
            /// 作者：Vincen
            /// 时间：2013.11.14 PM
            /// 描述：验证用户是否登录 （true/false）
            /// </summary>
            public static bool IsLogin
            {
                get { return (HttpContext.Current.Session[LoginUserKey] != null); }
            }

            /// <summary>
            /// 作者：Vincen
            /// 时间：2014.04.25
            /// 描述：标记当前登录用户
            /// </summary>
            /// <param name="user"></param>
            public static void SignLoginUser(LoginUser user)
            {
                //设置当前登录用户
                HttpContext.Current.Session[LoginUserKey] = user;

            }

         

         

        
            public static void Logout()
            {
  
                HttpContext.Current.Session.Abandon();
                HttpContext.Current.Session.Clear();
            }

          
           
        
    }
}